<template>
  <div class="group23">
    <h4>我是孙子组件</h4>
    <p>我想用页面组件的数据</p>
    <div>{{ props.chide2 }}</div>
    <hr />
    <div>爷爷的传家宝 ：{{ heshibi }}</div>
  </div>
</template>

<script setup lang="ts">
import { inject, type Ref } from 'vue'
import { myInjectionKey } from './keys'
const props = defineProps<{
  chide2: string
}>()

const { heshibi } = inject(myInjectionKey) as {
  heshibi: Ref<string>
}
const ss = inject<{ name: string }>('foo')
</script>

<style scoped>
.group23 {
  border: 2px solid rgb(25, 151, 160);
  margin: 10px;
  padding: 10px;
}
</style>
